# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.DFAReporting.V34.Model.CustomEvent do
  @moduledoc """
  Experimental feature (no support provided) A custom event represents a third party impression, a third party click, an annotation on a first party impression, or an annotation on a first party click.

  ## Attributes

  *   `annotateClickEvent` (*type:* `GoogleApi.DFAReporting.V34.Model.CustomEventClickAnnotation.t`, *default:* `nil`) - Annotate a click event. This field is mutually exclusive with insertEvent and annotateImpressionEvent. This or insertEvent and annotateImpressionEvent is a required field.
  *   `annotateImpressionEvent` (*type:* `GoogleApi.DFAReporting.V34.Model.CustomEventImpressionAnnotation.t`, *default:* `nil`) - Annotate an impression. This field is mutually exclusive with insertEvent and annotateClickEvent. This or insertEvent and annotateClickEvent is a required field.
  *   `customVariables` (*type:* `list(GoogleApi.DFAReporting.V34.Model.CustomVariable.t)`, *default:* `nil`) - Custom variables associated with the event.
  *   `eventType` (*type:* `String.t`, *default:* `nil`) - The type of event. If INSERT, the fields in insertEvent need to be populated. If ANNOTATE, the fields in either annotateClickEvent or annotateImpressionEvent need to be populated.
  *   `floodlightConfigurationId` (*type:* `String.t`, *default:* `nil`) - Floodlight configuration ID of the advertiser the event is linked to. This is a required field.
  *   `insertEvent` (*type:* `GoogleApi.DFAReporting.V34.Model.CustomEventInsert.t`, *default:* `nil`) - Insert custom event. This field is mutually exclusive with annotateClickEvent and annotateImpressionEvent. This or annotateClickEvent and annotateImpressionEvent is a required field.
  *   `kind` (*type:* `String.t`, *default:* `nil`) - Identifies what kind of resource this is. Value: the fixed string "dfareporting#customEvent".
  *   `ordinal` (*type:* `String.t`, *default:* `nil`) - The ordinal of this custom event. This is a required field.
  *   `timestampMicros` (*type:* `String.t`, *default:* `nil`) - The timestamp of this custom event, in Unix epoch micros. This is a required field.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :annotateClickEvent =>
            GoogleApi.DFAReporting.V34.Model.CustomEventClickAnnotation.t() | nil,
          :annotateImpressionEvent =>
            GoogleApi.DFAReporting.V34.Model.CustomEventImpressionAnnotation.t() | nil,
          :customVariables => list(GoogleApi.DFAReporting.V34.Model.CustomVariable.t()) | nil,
          :eventType => String.t() | nil,
          :floodlightConfigurationId => String.t() | nil,
          :insertEvent => GoogleApi.DFAReporting.V34.Model.CustomEventInsert.t() | nil,
          :kind => String.t() | nil,
          :ordinal => String.t() | nil,
          :timestampMicros => String.t() | nil
        }

  field(:annotateClickEvent, as: GoogleApi.DFAReporting.V34.Model.CustomEventClickAnnotation)

  field(:annotateImpressionEvent,
    as: GoogleApi.DFAReporting.V34.Model.CustomEventImpressionAnnotation
  )

  field(:customVariables, as: GoogleApi.DFAReporting.V34.Model.CustomVariable, type: :list)
  field(:eventType)
  field(:floodlightConfigurationId)
  field(:insertEvent, as: GoogleApi.DFAReporting.V34.Model.CustomEventInsert)
  field(:kind)
  field(:ordinal)
  field(:timestampMicros)
end

defimpl Poison.Decoder, for: GoogleApi.DFAReporting.V34.Model.CustomEvent do
  def decode(value, options) do
    GoogleApi.DFAReporting.V34.Model.CustomEvent.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.DFAReporting.V34.Model.CustomEvent do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
